﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace PcProject.Domain.Models.Entities
{
    /// <summary>
    /// 商品表
    /// </summary>
    [Table("Product")]
    public class Product:IAggregateRoot
    {
        protected Product() { }

        public Product(int ProId,string ProName,int ProType,decimal Price,decimal NewPrice,string PicUrl,int Sales,string ProAdress,int SheifLife,int ProNum,int Sort,int Inventory,int UpOrSet,int IsDelete,DateTime AddTime,string Bought,string Business)
        {
            this.ProId = ProId;
            this.ProName = ProName;
            this.ProType = ProType;
            this.Price = Price;
            this.NewPrice = NewPrice;
            this.PicUrl = PicUrl;
            this.Sales = Sales;
            this.ProAdress = ProAdress;
            this.SheifLife = SheifLife;
            this.ProNum = ProNum;
            this.Sort = Sort;
            this.Inventory = Inventory;
            this.UpOrSet = UpOrSet;
            this.IsDelete = IsDelete;
            this.AddTime = AddTime;
            this.Bought = Bought;
            this.Business = Business;
        }

        [Key]
        public int ProId { get; set; }
        /// <summary>
        /// 商品名称
        /// </summary>
        [StringLength(20)]
        public string ProName { get; set; }
        /// <summary>
        /// 商品类型
        /// </summary>
        public int ProType { get; set; }
        /// <summary>
        /// 规格外键ID
        /// </summary>
        public int SpeId { get; set; }
        /// <summary>
        /// 商品原价
        /// </summary>
        public decimal Price { get; set; }
        /// <summary>
        /// 商品现价
        /// </summary>
        public decimal NewPrice { get; set; }
        /// <summary>
        /// 商品图片
        /// </summary>
        public string PicUrl { get; set; }
        /// <summary>
        /// 销量
        /// </summary>
        public int Sales { get; set; }
        /// <summary>
        /// 收货地址
        /// </summary>
        public string ProAdress { get; set; }
        /// <summary>
        /// 保质期
        /// </summary>
        public int SheifLife { get; set; }
        /// <summary>
        /// 商品数量
        /// </summary>
        public int ProNum { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        public int Sort { get; set; }
        /// <summary>
        /// 库存
        /// </summary>
        public int Inventory { get; set; }
        /// <summary>
        /// 状态
        /// </summary>
        public int UpOrSet { get; set; }
        /// <summary>
        /// 是否删除
        /// </summary>
        public int IsDelete { get; set; }
        /// <summary>
        /// 添加时间
        /// </summary>
        public DateTime AddTime { get; set; }
        /// <summary>
        /// 买过
        /// </summary>
        public string Bought { get; set; }
        /// <summary>
        /// 商家
        /// </summary>
        public string Business { get; set; }

        /// <summary>
        /// 加入回收站
        /// </summary>
        /// <param name="isdel"></param>
        public void AddRecy(int isdel = 2)
        {
            this.IsDelete = isdel;
        }

        /// <summary>
        /// 还原
        /// </summary>
        /// <param name="isdel"></param>
        public void OutRecy(int isdel = 1)
        {
            this.IsDelete = isdel;
        }

    }
}
